﻿using UnityEngine;
using System.Collections;

public class FloorGene : MonoBehaviour {
    public GameObject _floor;
    public GameObject _empty;
    public GameObject _endPoint;
    public Transform _root;
    
    int[,] arr = new int[8, 12] { {0,0,0,0,0,0,0,0,0,0,0,0 },{0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,0 },{0, 0,0,0,0,0,1,1,2,1,1,0 }, {0,0,1,1,1,1,1,1,1,1,1,0 }, {0,1,1,1,1,1,1,1,1,1,0,0 }, {0,1,1,1,1,1,1,0,0,0,0,0 }, {0,1,1,1,0,0,0,0,0,0,0,0 }, {0,0,0,0,0,0,0,0,0,0,0,0 } };
	// Use this for initialization
	void Start () {
        for (int i = 0; i < 8; i++) {
            for (int j = 0; j < 12; j++) {
                if (arr[i, j] == 1)
                {
                    GameObject go = Instantiate(_floor, new Vector3(j, 0, i), Quaternion.identity) as GameObject;
                    go.name = i + "-" + j;
                    go.transform.parent = _root;
                }
                else if (arr[i, j] == 0)
                {
                    GameObject go = Instantiate(_empty, new Vector3(j, 0, i), Quaternion.identity) as GameObject;
                    go.name = i + "-" + j;

                    go.transform.parent = _root;
                }
                else {
                    GameObject go = Instantiate(_endPoint
                        , new Vector3(j, 0, i), Quaternion.identity) as GameObject;
                    go.name = i + "-" + j;

                    go.transform.parent = _root;
                }
            }
        }
	}
	
	// Update is called once per frame
	void Update () {
	
	}


}
